package com.br.negocio.vo;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;

@Entity
@Table(name = "colaborador")
@SequenceGenerator(name = "colaborador_seq", sequenceName = "colaborador_cod_colaborador_seq", allocationSize = 1)
@NamedQueries ({
	@NamedQuery(name = "loadAllColaborador", query = "from ColaboradorVO as f order by f.codigo"),
	@NamedQuery(name = "findColaborador", query = "from ColaboradorVO as f where f.codigo = :codigo"),
	@NamedQuery(name = "findDuplicatedColaborador", query = "from ColaboradorVO as f where  f.codigo != :codigo")
})
public class ColaboradorVO extends PessoaVO implements Serializable {

	private static final long serialVersionUID = 1L;

	@Id
	@Column(name = "cod_colaborador")
	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "colaborador_seq")
	private int codigo;
	
	//Nome
	@Column(name = "nome", nullable = false, length = 50)
	private String nome;
	
	@Column(name = "rg", length = 20)
	private String rg;
	
	@Column(name = "cpf", length = 20)
	private String cpf;
	
	@Column(name = "telefone_residencial", length = 8)
	private String telefoneResidencial;
	
	@Column(name = "telefone_celular", length = 8)
	private String telefoneCelular;
	
	@Column(name = "email", length = 50)
	private String email;
	
	@Column(name = "guia", length = 25)
	private String guia;
	
	@Column(name = "cod_sexo")
	private int sexo;
	
	//Data Nascimento 
	@Temporal(TemporalType.DATE)
	@Column(name = "data_nascimento")
	private Date data;
	
	@JoinColumn(name = "cod_carro")
	@Fetch(FetchMode.JOIN)
	private CarroVO carroVO;
	
	public ColaboradorVO() {
	}

	public int getCodigo() {
		return this.codigo;
	}

	public void setCodigo(int codigo) {
		this.codigo = codigo;
	}

	public String getNome() {
		return this.nome;
	}

	public void setNome(String nome) {
		this.nome = nome;
	}

	public String getTelefoneResidencial() {
		return this.telefoneResidencial;
	}

	public void setTelefoneResidencial(String telefoneResidencial) {
		this.telefoneResidencial = telefoneResidencial;
	}

	public String getTelefoneCelular() {
		return this.telefoneCelular;
	}

	public void setTelefoneCelular(String telefoneCelular) {
		this.telefoneCelular = telefoneCelular;
	}

	public String getEmail() {
		return this.email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public Date getData() {
		return this.data;
	}

	public void setData(Date data) {
		this.data = data;
	}

	public String getGuia() {
		return guia;
	}

	public void setGuia(String guia) {
		this.guia = guia;
	}

	public int getSexo() {
		return sexo;
	}

	public void setSexo(int sexo) {
		this.sexo = sexo;
	}

	public String getRg() {
		return rg;
	}

	public void setRg(String rg) {
		this.rg = rg;
	}

	public String getCpf() {
		return cpf;
	}

	public void setCpf(String cpf) {
		this.cpf = cpf;
	}

	public CarroVO getCarroVO() {
		return carroVO;
	}

	public void setCarroVO(CarroVO carroVO) {
		this.carroVO = carroVO;
	}
	
	
}